/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.manager.consultar;

import br.com.deployment.entidade.selo.TipoSelo;
import br.com.deployment.servico.TipoSeloServico;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author elyjr
 */
@ManagedBean
@SessionScoped
public class ManagerConsultarTipoSelo implements Serializable{
    
    
    @EJB
    TipoSeloServico tipoSeloServico;
    
    private TipoSelo tipoSelo;

    private List<TipoSelo> tipoSelos;

    public ManagerConsultarTipoSelo() {
       tipoSelo = new TipoSelo();
       tipoSelos = new ArrayList<TipoSelo>();
    }
    
    public void reinit(){
       tipoSelo = new TipoSelo();
       tipoSelos = new ArrayList<TipoSelo>();
    }    
    public void buscarTipoSelo(){
       tipoSelos = tipoSeloServico.findTipoSeloPesquisar(tipoSelo); 
    }

     public void redirect(String string) {
        try {
            FacesContext context = FacesContext.getCurrentInstance();
            reinit();
            context.getExternalContext().redirect(string);
        } catch (IOException ex) {
            Logger.getLogger(ManagerConsultarTipoSelo.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    
    public TipoSelo getTipoSelo() {
        return tipoSelo;
    }

    public void setTipoSelo(TipoSelo tipoSelo) {
        this.tipoSelo = tipoSelo;
    }

    public List<TipoSelo> getTipoSelos() {
        return tipoSelos;
    }

    public void setTipoSelos(List<TipoSelo> tipoSelos) {
        this.tipoSelos = tipoSelos;
    }
    
    
    
    
    
    
    
}
